<?php

/**
 * This is the model class for table "d_pdpt".
 *
 * The followings are the available columns in table 'd_pdpt':
 * @property integer $ID
 * @property string $THANG
 * @property string $KDSATKER
 * @property string $KDDEPT
 * @property string $KDUNIT
 * @property string $KDPROGRAM
 * @property string $KDGIAT
 * @property string $KDAKUN
 * @property string $KDPNBPF
 * @property string $RPHMIN1
 * @property string $RPHPDPT
 * @property string $RPHPLS1
 * @property string $RPHPLS2
 * @property string $RPHPLS3
 * @property string $_NullFlags
 */
class DPdpt extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return DPdpt the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'd_pdpt';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('THANG, KDGIAT', 'length', 'max'=>4),
			array('KDSATKER, KDAKUN', 'length', 'max'=>6),
			array('KDDEPT', 'length', 'max'=>3),
			array('KDUNIT, KDPROGRAM', 'length', 'max'=>2),
			array('KDPNBPF', 'length', 'max'=>1),
			array('RPHMIN1, RPHPDPT, RPHPLS1, RPHPLS2, RPHPLS3', 'length', 'max'=>19),
			array('_NullFlags', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ID, THANG, KDSATKER, KDDEPT, KDUNIT, KDPROGRAM, KDGIAT, KDAKUN, KDPNBPF, RPHMIN1, RPHPDPT, RPHPLS1, RPHPLS2, RPHPLS3, _NullFlags', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ID' => 'ID',
			'THANG' => 'Thang',
			'KDSATKER' => 'Kdsatker',
			'KDDEPT' => 'Kddept',
			'KDUNIT' => 'Kdunit',
			'KDPROGRAM' => 'Kdprogram',
			'KDGIAT' => 'Kdgiat',
			'KDAKUN' => 'Kdakun',
			'KDPNBPF' => 'Kdpnbpf',
			'RPHMIN1' => 'Rphmin1',
			'RPHPDPT' => 'Rphpdpt',
			'RPHPLS1' => 'Rphpls1',
			'RPHPLS2' => 'Rphpls2',
			'RPHPLS3' => 'Rphpls3',
			'_NullFlags' => 'Null Flags',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ID',$this->ID);
		$criteria->compare('THANG',$this->THANG,true);
		$criteria->compare('KDSATKER',$this->KDSATKER,true);
		$criteria->compare('KDDEPT',$this->KDDEPT,true);
		$criteria->compare('KDUNIT',$this->KDUNIT,true);
		$criteria->compare('KDPROGRAM',$this->KDPROGRAM,true);
		$criteria->compare('KDGIAT',$this->KDGIAT,true);
		$criteria->compare('KDAKUN',$this->KDAKUN,true);
		$criteria->compare('KDPNBPF',$this->KDPNBPF,true);
		$criteria->compare('RPHMIN1',$this->RPHMIN1,true);
		$criteria->compare('RPHPDPT',$this->RPHPDPT,true);
		$criteria->compare('RPHPLS1',$this->RPHPLS1,true);
		$criteria->compare('RPHPLS2',$this->RPHPLS2,true);
		$criteria->compare('RPHPLS3',$this->RPHPLS3,true);
		$criteria->compare('_NullFlags',$this->_NullFlags,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}